//#define __FORCE_TRACE__
//#define __FORCE_DEBUG__
//#define __FORCE_INFO__
#define THIS_FILE "tmf\client\fn_postInitExec.sqf"
#include <core_macros.h>

if (!(isNil "TMF_INITIALIZED") && {TMF_INITIALIZED}) then {
	private ["_input","_params","_id","_result"];
	_input = _this;
	_result = false;
	if (IS_ARRAY(_input) && {count _input > 2}) then {
		_id = GETVAL(_input,0,"");
		_params = GETVAL(_input,2,[]);
		TRACE_1("Extracted",ARR_2(_id,_params));
		// We remove this function since it won't be needed anymore
		["itemRemove", _id] call MFUNC(fsmloop);
		
		private ["_uid","_trg"];
		
		_uid = ["UID"] call MFUNC(fsmloop);
		["itemAdd", [_uid, QUOTE(FUNC(ammoBoxExec)),[],8.3569,"seconds","","",false,true]] call MFUNC(fsmloop);

		_trg = createTrigger ["EmptyDetector", getPos player];
		_trg setTriggerArea [0, 0, 0, false];
		_trg setTriggerActivation ["NONE", "PRESENT", true];
		_trg setTriggerStatements ["vehicle player != player && {alive player} && {!(player call mso_fnc_isUnc)}", "(['MSO','EnterVehicle',player] call ioc_fnc_exec)", "(['MSO','ExitVehicle',player] call ioc_fnc_exec)"];
	};
};